﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;


namespace jaam_butters
{
    class StoryScreen : GameScreen
    {
        KeyboardState keyboardstate;
        KeyboardState oldkeyboardstate;

        Rectangle imageRec;
        Texture2D[] storylist;
        int SelectedItem;

        private bool CheckKey(Keys theKey) {
            return keyboardstate.IsKeyUp(theKey) && oldkeyboardstate.IsKeyDown(theKey);
        }

        public int selectedItem {
            get {
                return SelectedItem;
            }
            set {
                SelectedItem = value;
            }
        }
        public Texture2D[] storypic
        {
            get
            {
                return storylist;
            }
            set
            {
                storylist = value;
            }
        }

        public StoryScreen(Game game, SpriteBatch spriteBatch, Texture2D[] storypic) : base(game, spriteBatch) {
            this.spriteBatch = spriteBatch;
            storylist = storypic;
            imageRec = new Rectangle(0, 0, Game.Window.ClientBounds.Width, Game.Window.ClientBounds.Height);
            SelectedItem = 0;
        }

        public override void Update(GameTime gameTime)
        {
            keyboardstate = Keyboard.GetState();
            if (CheckKey(Keys.Enter)) {
                SelectedItem++;                
            }
            base.Update(gameTime);
            oldkeyboardstate = keyboardstate;
        }

        public override void Draw(GameTime gameTime)
        {
            for (int i = 0; i < storylist.Length; i++) {
                if (i == SelectedItem)
                    spriteBatch.Draw(storylist[i], imageRec, Color.White);
            }
            base.Draw(gameTime);
        }



    }
}
